package com.companyname.projecttemplate.ws;

import java.util.function.Consumer;

import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import com.base.core.context.annotation.WsCheck;
import com.base.core.head.ao.WsMessageAO;
import com.base.core.mvc.ws.WsBaseMessage;
import com.companyname.projecttemplate.constants.BizTypeConstants;

import io.swagger.v3.oas.annotations.ExternalDocumentation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;

/**
 * @author start
 */
@Tag(name = "测试Ws",description = BizTypeConstants.SYS,
externalDocs =@ExternalDocumentation(description ="技术方案",url = "https://www.baidu.com"))
@Service
public class WsSysMessage implements WsBaseMessage{

	@Override
	public boolean support(String name) {
		return BizTypeConstants.SYS.equals(name);
	}

	@Override
	public void afterPropertiesSet(Long userId) {
		
	}

	@Override
	public void destory(Long userId) {
		
	}
	
	///////////////////
	
	@WsCheck
	@Operation(summary ="ping")
	@PostMapping("ping")
	public void ping(
			@RequestBody WsMessageAO<String> ao,
			@Parameter(hidden = true) Consumer<Object> ws) {
		System.out.println(ao);
	}

}
